/*
 * Copyright (C) 2018 guomw.Inc. All rights reserved.
 * 项目名称： report-manage
 * 文件名称： SystemRole.java
 * Date：18-11-5 上午10:54
 * Author: guomw
 */

package com.guomw.report.service.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.guomw.report.common.config.Constant;
import lombok.Data;

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * 系统角色
 *
 * @author guomw
 * @date 2018/9/14
 */
@Entity
@Data
@Table(name = "bxs_sys_role",
        uniqueConstraints = {@UniqueConstraint(columnNames = {"roleId"})},
        indexes = {@Index(columnList = "userId")}
)
public class SystemRole {
    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "role_id")
    private Integer roleId;

    /**
     * 用户ID
     */
    @Column(name = "user_id")
    private Integer userId;

    /**
     * 角色名称
     */
    @Column(name = "role_name")
    private String roleName;

    /**
     * 菜单权限，多个权限用'|' 隔开
     */
    @Column(name = "authority",columnDefinition = "text")
    private String authority;


    /**
     * 是否启用
     */
    @Column(name = "enable")
    private boolean enable;

    /**
     * 系统默认角色,-1 为系统超级管理员角色
     */
    @Column(name = "role_type")
    private int roleType;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = Constant.DATETIME_FORMAT)
    @Column(name = "create_time", columnDefinition = "datetime")
    private LocalDateTime createTime;
}
